package com.blog.wu.myblog.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/*
 * springboot 访问静态资源配置
 *
 * @return
 * @Date 2018/12/5 3:53 PM
 * @Author wuyanshen
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	@Value("${ckeditor.storage.image.path}")
	private String baseDir;

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/public/image/**").addResourceLocations("file://"+baseDir+"/");
//		registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
//		registry.addResourceHandler("/ckfinder/**").addResourceLocations("classpath:/static/ckfinder/");
	}
}
